/*
 * Include file for user programs using the Mathomatic symbolic math library API.
 */
/**
 * This comment added by Kenley 12 Oct 2012
 * 
 * This file in its original form was part of the Mathomatic Symbolic Math Library
 * developed by George Gesslein II <gesslein@mathomatic.org> "Chief Mathomatic
 *  creator, author, maintainer, and copyright holder." - from source readme see
 * http://www.mathomatic.org.
 * 
 * Changes made by Kenley:
 * 1. Added extern "C" {...}
 * 2. Added/changed comments.
 * 
 */

extern "C" {
    /**
     * One-time Mathomatic initialization. 
     * 
     * @return one if successful. Otherwise there is an error.
     */
    int matho_init(void);
	
    /**
     * Mathomatic command or expression input.
     * 
     * @param input
     * @param outputp a pointer to the output. Will be null/false if ??.
     * @return one if successful. Zero otherwise?
     */
    int matho_process(char *input, char **outputp);
	
    /**
     * Mathomatic expression or equation input.
     * 
     * @param input a pointer to a char string to process. 
     * @param outputp a pointer to the output. Will be null/false if ??.
     * @return one if successful. Zero otherwise?
     */
    int matho_parse(char *input, char **outputp);
	
    /**
     * Restart Mathomatic quickly and cleanly, replaces clear_all().
     */
    void matho_clear(void);

    void free_mem(void); /* Free all allocated memory before quitting Mathomatic, if operating system doesn't when done. */
    /* Mathomatic becomes unusable after free_mem(), until matho_init() is called again. */
    /* Only Symbian OS is known to need a call to free_mem() before quitting. */

    int load_rc(int return_true_if_no_file, FILE *ofp); /* Load Mathomatic startup set options from ~/.mathomaticrc, should allow "set save" to work. */

    extern int cur_equation; /* current equation space number (origin 0) */

    extern int result_en; /* Equation number of the API's returned result, */
    /* if the result is also stored in an equation space, */
    /* otherwise -1 for no equation number associated with result. */
    /* Set by the last call to matho_parse() or matho_process(). */
    /* Useful if you want to know where the result string is from, */
    /* to act on it with further commands. */

    extern const char *warning_str; /* optional warning message generated by the last command */
}